package com.bestvike.stone.spring.trace.feign;

import com.bestvike.stone.spring.feign.core.DelegateMethodHandler;
import lombok.extern.apachecommons.CommonsLog;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by 许崇雷 on 2018-02-10.
 */
@CommonsLog
public final class OutgoingLog {
    public static Map<String, Object> writeBeginLog(DelegateMethodHandler handler) {
        Map<String, Object> map = new LinkedHashMap<>();
        map.put("name", handler.getName());
        log.info("==>Call Feign Api Begin: " + map);
        return map;
    }

    public static void writeEndLog(Map<String, Object> map, long tookMs) {
        map.put("took", tookMs);
        log.info("==>Call Feign Api End: " + map);
    }
}
